﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Hue {
	public partial class formMain : Form {
		public formMain() {
			InitializeComponent();
		}

		private void formMain_Load(object sender, EventArgs e) {
			linkRGB.Text = "";
			linkHTML.Text = "";
			linkKnownColor.Text = "";

			Cursor c = new System.Windows.Forms.Cursor(@"C:\SVN\Public\Google Code\HUE\SUPPORT\cur.cur");
			
			this.Cursor = c;

		}

		private void eyeDrop_SelectedColorChanged(object sender, UC.SelectedColorChangedEventArgs e) {
			setColorSwatches(e.SelectedColor);
		}

		private void linkKnownColor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {

		}

		private void linkRGB_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
			Clipboard.SetText(linkRGB.Text);
		}

		private void linkHTML_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
			Clipboard.SetText(linkHTML.Text);
		}


		private void setColorSwatches(Color baseColor) {
			picColor.BackColor = baseColor;

			linkRGB.Text = ColorHelper.ToRGBString(baseColor);
			linkHTML.Text = ColorHelper.ToHEX(baseColor);

			List<Color> cs = ColorHelper.GetColorGradients(baseColor, 6);
			picColorD1.BackColor = cs[0];
			picColorD2.BackColor = cs[1];
			picColorD3.BackColor = cs[2];
			picColorD4.BackColor = cs[3];
			picColorD5.BackColor = cs[4];
			picColorD6.BackColor = cs[5];
		}

		private void colorSwatch_Click(object sender, EventArgs e) {
			PictureBox src = (PictureBox)sender;
			setColorSwatches(src.BackColor);
		}


	}
}
